package com.icangya.DAO.impl;

import com.icangya.DAO.IGoodsSalesReturnRecordDAO;
import com.icangya.Utils.SQLUtilt;
import com.icangya.domain.GoodsSalesReturnRecord;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import java.util.List;

import static com.icangya.Value.FootBall.FOOT_PAGE_ROW;

@Repository
public class GoodsSalesReturnRecordDAOImpl extends BaseDAO<GoodsSalesReturnRecord> implements IGoodsSalesReturnRecordDAO {


    @Override
    public List<Object> goodSalesReturnRecord(Long uid, Integer pageNum) {
        String hql="FROM GoodsSalesReturnRecord er where er.uid='"+uid+"' order by er.createTime desc";
        String count = "SELECT COUNT(er) " + hql;
        Long total = (Long) getHibernateTemplate().find(count).get(0);
        return SQLUtilt.getIstance().doPage(getHibernateTemplate(), hql, total, pageNum, FOOT_PAGE_ROW);
    }
}
